package org.xenon.vote.model.pojo.po;

import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 用户对象
 */
public class User {

    /**
     * 用户昵称
     */
    @NotNull(message = "name.null")
    @NotBlank(message = "name.blank")
    private String name;

    /**
     * 用户密码
     */
    @NotNull(message = "password.null")
    @NotBlank(message = "password.blank")
    @Max(value = 32)
    private String password;

    /**
     * 用户邮箱, 找回密码等用途, 主键
     */
    @NotNull(message = "mail.null")
    @NotBlank(message = "mail.blank")
    @Email(message = "mail.format")
    @Max(value = 128)
    private String mail;

    /**
     * 用户分组, 暂时只有user组
     * 数据库默认值为user
     */
    @NotNull(message = "group.null")
    @NotBlank(message = "group.blank")
    private String group;

    public User(@NotNull(message = "name.null")
                @NotBlank(message = "name.blank") String name,
                @NotNull(message = "password.null")
                @NotBlank(message = "password.blank") String password,
                @NotNull(message = "mail.null")
                @NotBlank(message = "mail.blank")
                @Email(message = "mail.format") String mail,
                @NotNull(message = "group.null")
                @NotBlank(message = "group.blank") String group) {
        this.name = name;
        this.password = password;
        this.mail = mail;
        this.group = group;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }
}
